package File;

import java.io.File;
import java.io.FileFilter;

/**
 * 说明:
 *
 * @author: luohaowei
 * @date:2023/3/6
 **/
public class ListFilesDemo3 {
    public static void main(String[] args) {
        File dir=new File(".");
        if(dir.isDirectory()){
            File[] subs=dir.listFiles(file ->file.getName().endsWith(".txt"));
                 for (File sub:subs){
                     System.out.println(sub.getName()   );
                 }



        }
    }
}
